import { request } from '@/utils/request';
// import type { BaseResponse } from '@/utils/request';
import Api from '@/core/permission/modules/data/meterreading';

export function getMeterreadingInfo(query: { id: string }) {
  return request<API.MeterreadingInfoResult>({
    url: Api.info,
    method: 'get',
    params: query,
  });
}

export function getMeterreadingList(query?: API.PageParams) {
  return request<API.MeterreadingListResult>({
    url: Api.list,
    method: 'get',
    params: query,
  });
}

export function createMeterreading(data: API.CreateMeterreadingParams) {
  return request(
    {
      url: Api.add,
      method: 'post',
      data,
    },
    {
      successMsg: '创建水表读数成功',
    },
  );
}

export function editMeterreading(data: API.UpdateMeterreadingParams) {
  return request(
    {
      url: Api.edit,
      method: 'post',
      data,
    },
    {
      successMsg: '更新水表读数成功',
    },
  );
}

export function deleteMeterreading(data: string[]) {
  return request(
    {
      url: Api.delete,
      method: 'delete',
      data,
    },
    {
      successMsg: '删除水表读数成功',
    },
  );
}
